//
//  LSZTertiaryInterfaceTableViewCell.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/8/27.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZTertiaryInterfaceTableViewCell.h"

@implementation LSZTertiaryInterfaceTableViewCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.labelNum = [[UILabel alloc]init];
        self.labelNum.textColor = lightColor;
        self.labelNum.font = FONT_(15);
        self.labelNum.textAlignment = NSTextAlignmentCenter;
        self.labelNum.frame = CGRectMake(0, 20, 50, 22);
        [self addSubview:self.labelNum];
        //可变
        self.labelTitle = [[UILabel alloc]init];
        self.labelTitle.frame = CGRectMake(CGRectGetMaxX(self.labelNum.frame), 10, ScreenWidth-100-CGRectGetMaxX(self.labelNum.frame), 50);
        self.labelTitle.numberOfLines = 0;
        self.labelTitle.textColor = titleColorLSZ;
        self.labelTitle.font = FONT_(16);
        [self addSubview:self.labelTitle];
        
        self.imageViewBrowse = [[UIImageView alloc]init];
        self.imageViewBrowse.image = [UIImage imageNamed:@"浏览"];
        self.imageViewBrowse.frame = CGRectMake(CGRectGetMinX(self.labelTitle.frame),  CGRectGetMaxY(self.labelTitle.frame), 22, 22);
        [self addSubview:self.imageViewBrowse];
        
        self.labelBrowse = [[UILabel alloc]init];
        self.labelBrowse.textColor = lightColor;
        self.labelBrowse.font = FONT_(13);
        self.labelBrowse.frame = CGRectMake(CGRectGetMaxX(self.imageViewBrowse.frame)+5, CGRectGetMinY(self.imageViewBrowse.frame), 50, 22);
        [self addSubview:self.labelBrowse];
        
        self.labelTime = [[UILabel alloc]init];
        self.labelTime.textColor = lightColor;
        self.labelTime.font = FONT_(13);
        self.labelTime.textAlignment = NSTextAlignmentRight;
        self.labelTime.frame = CGRectMake(CGRectGetMaxX(self.labelTitle.frame), 10+10, 90, 22);
        [self addSubview:self.labelTime];
        
    }
    return self;
}

-(void)setTertiaryInterfaceMg:(LSZTertiaryInterfaceMg *)tertiaryInterfaceMg
{
    self.labelTitle.text = tertiaryInterfaceMg.name;
    self.labelTime.text = tertiaryInterfaceMg.publishTime;
    
    self.labelBrowse.text = tertiaryInterfaceMg.sortIndex;

    CGFloat height = [LSZSpecialPackaging getHeightOfText:ScreenWidth-50-100 height:ScreenHeight*10 font:16 :self.labelTitle.text];
    CGRect rect = self.labelTitle.frame;
    rect.size.height = height;
    self.labelTitle.frame = rect;
    
    CGRect rect1 = self.imageViewBrowse.frame;
    rect1.origin.y = CGRectGetMaxY(self.labelTitle.frame);
    self.imageViewBrowse.frame = rect1;
    
    CGRect rect2 = self.labelBrowse.frame;
    rect2.origin.y = CGRectGetMaxY(self.labelTitle.frame);
    self.labelBrowse.frame = rect2;
}

@end
